'use strict';

var app = angular.module('app', ['ionic','app.controllers', 'app.services'])


.config(['$stateProvider','$urlRouterProvider',function($stateProvider, $urlRouterProvider) {

	// Ionic uses AngularUI Router which uses the concept of states
	// Learn more here: https://github.com/angular-ui/ui-router
	// Set up the various states which the app can be in.
	// Each state's controller can be found in controllers.js
	$stateProvider

		// 首页
		.state('welcome',{
			url:'/welcome',
			templateUrl:'views/welcome.html',
			controller:'WelcomeCtrl'
		})

		// setup an abstract state for the tabs directive
		.state('list', {
			url: "/list",
			abstract: true,
			templateUrl: "views/list-tab.html"
		})

		.state('list.list-index', {
			url: '/index/:page',
			views: {
				'list-index': {
					templateUrl: 'views/list-index.html',
					controller: 'ListCtrl'
				}
			}
		})

        .state('list.list-create', {
            url: '/create',
            views: {
                'list-create': {
                    templateUrl: 'views/list-create.html',
                    controller: 'ListCreateCtrl'
                }
            }
        })

        .state('list.list-edit', {
            url: '/edit/:listId',
            views: {
                'list-create': {
                    templateUrl: 'views/list-edit.html',
                    controller: 'ListEditCtrl'
                }
            }
        })

		.state('help',{
			url:'/help',
			templateUrl:'views/help.html',
			// controller:'HelpCtrl'
		})
		;

	// if none of the above states are matched, use this as the fallback
	// 默认路由
	$urlRouterProvider.otherwise('/welcome');

}])

;